{include 'header.tpl'}
<form method="get" action="/adminmall/goods/goodsTj" class="form-inline">
    <table>
        <tr>
            <td>
                <label for="form-w" class="control-label">时间范围：</label>
                <input type="text" class="date-picker" id="begin_date" name="begin_date" value="{$begin_date}" style="width: 85px;"/> 至 <input type="text" class="date-picker" id="end_date" name="end_date" value="{$end_date}" style="width: 85px;"/>
            </td>

            <td>
                <button type="submit" class="btn btn-primary">查找</button>
                <a href="/adminmall/goods/goodsTj" class="btn btn-danger">清空条件</a>
                <button type="button" onclick="dao()" class="btn btn-primary">导出</button>
            </td>
        </tr>
    </table>
</form>
<div class="clearfix" style="height:30px;"></div>


<br>


<table class="table" style="table-layout: fixed;WORD-BREAK: break-all; WORD-WRAP: break-word">
    <tr>
        <td>日期</td>
        <td>销量排序</td>
        <td>产品名称</td>
        <td>商品规格</td>
        <td>商品销售数量</td>
        <td>商品单价</td>
        <td>销售总金额</td>
        <td>商品单成本</td>
        <td>商品单利润</td>
        <td>商品总利润</td>
    </tr>
    {$j=0}
    {foreach from=$data item=item}

        <tr {if $j lt 10}style="color: red" {/if}>
            <td>{$begin_date}~{$end_date}</td>
            <td>{$j+1}</td>
            <td>{$item['goods_detail']['title']}</td>
            <td>
                {$tmp = json_decode($item['goods_detail']['spec_list'])}
                {*{$tmp->value}*}
                {*{$tmp = json_decode($v1['spec_list'])}*}
                {$new = ""}
                {foreach $tmp as $k => $v}
                    {$new = json_decode($v)}
                {/foreach}
                {$new->value}
            </td>
            <td>{$item.paynum_sum}</td>
            <td>{$item['goods_detail']['price_new']}</td>
            <td>{$item['goods_detail']['price_new']*$item['paynum_sum']}</td>
            <td>{$item['goods_detail']['purchase_price']}</td>
            {$profit=$item['goods_detail']['price_new']-$item['goods_detail']['purchase_price']}
            <td>{$profit}</td>
            <td>{$profit*$item['paynum_sum']}</td>
        </tr>
        {$j=$j+1}
    {/foreach}
</table>
{include "pager.tpl"}
<script type="text/javascript">
    $(function () {
        create_date_picker();
    });

    function dao(){
        var begin_date = $('#begin_date').val();
        var end_date = $('#end_date').val();
//        alert(intention);
//        alert(nickname);
//        alert(mobile);
//        alert(end_date);

        location.href = "/goods/excelGoods?begin_date=" + begin_date + "&end_date=" + end_date;

    }
</script>
{include 'footer.tpl'}